package com.tedu.bill.demo2;

/**
 * Author：毕龙
 * Date: 2024/5/24 10:44
 */
public class TestThreadMethodGetName {
    public static void main(String[] args) {
        //获取当前的线程
        System.out.println(Thread.currentThread().getName());

        //在创建线程时  有一个共享的线程编号
        //获取线程的名字 Thread-ThreadInitNum++
        Thread t1 = new Thread(() -> {
            System.out.println("当前的线程名字："+Thread.currentThread().getName());
        });
        Thread t2 = new Thread(() -> {
            System.out.println("当前的线程名字："+Thread.currentThread().getName());
        });

       t1.start();
        System.out.println(t1.getName());
        System.out.println(t2.getName());
        t2.start();
    }
}
